<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
    <script src="../js/jquery.min.js"></script>
</head>
<body>
    <script>
        console.log("------2.28find方法-------");
        let arr = Array.of(2,4,6,8);
        console.log(arr.find(item => item >2 ))//4
        //找出数组中第一个大于2的元素

        console.log("=======2.29dindIndex方法======");
        let arr1 = Array.of(1,3,1,2);
        console.log(arr1.findIndex(item => item == 2));//3
        //返回元素的索引


        console.log("-------2.30fill方法-------");
        let arr2 = Array.of(1,2,3,4,5);
        console.log(arr2.fill(0,1,4));//[1,0,0,0,5]
        console.log(arr2.fill(0,1,6));//[1,0,0,0,0]
        console.log(arr2);
        //参数一：用来填充的值
        //参数二：被填充的起始索引
        //参数三：被填充的结束索引，默认为数组末尾


    </script>
    
</body>
</html>